home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 48 / PC Gamer IT CD 48 1-2.iso / age2 / AoE2demo.exe / 1033 / CABFILE / MSGAME.CAB / Data / gamedata.drs / Unnamed File 000002.bina < prev    next >
Text File  |  1999-10-01  |  46KB  |  2,446 lines

  1. ;goals 1 and 2 = boats
  2. ;goal 3 = groups
  3. ;goal combat-arm = his unique unit type (also loads correct upgrades)
  4. ;goal 36 = good infantry -- 36 NO = don't build, YES = build, 
  5. ;    2 = only build if we don't have a castle. 
  6. ;goal 37 = good cavalry
  7. ;goal 38 = good horse-archers
  8. ;goal 39 = good archers
  9.  
  10. ;starting loads
  11. ;*********************************************************
  12. ;*********************************************************
  13. #load-if-defined BRITON-CIV
  14. ;train longbows, champs, lt cav
  15. (defrule
  16.     (goal combat-arm NOTICE)
  17. =>
  18.     (set-goal combat-arm ARCHER)
  19.     (set-goal 36 YES)
  20.     (set-goal 37 NO)
  21.     (set-goal 38 YES)
  22.     (set-goal 39 2)
  23.  
  24.     (set-strategic-number sn-wood-gatherer-percentage 35)
  25.     (set-strategic-number sn-food-gatherer-percentage 25)
  26.     (set-strategic-number sn-gold-gatherer-percentage 35)
  27.     (set-strategic-number sn-stone-gatherer-percentage 5)
  28.     (disable-self)
  29. )
  30.  
  31. (defrule
  32.     (goal secondary-build 1)
  33. =>
  34.     (generate-random-number 2)
  35. )
  36.  
  37. (defrule
  38.     (goal secondary-build 1)
  39.     (random-number == 1)
  40.     (can-train champion)
  41.     (or
  42.         (population < deathmatch-unit-max)
  43.         (and
  44.             (population < unit-max)
  45.             (goal need-deathmatch-villagers NO)
  46.         )
  47.     )
  48. =>
  49.     (train champion)
  50.     (set-goal secondary-build 0)
  51. )
  52.  
  53. (defrule
  54.     (goal secondary-build 1)
  55.     (random-number == 2)
  56.     (can-train light-cavalry)
  57.     (or
  58.         (goal combat-arm 1)
  59.         (goal combat-arm 5)
  60.     )
  61.     (or
  62.         (population < deathmatch-unit-max)
  63.         (and
  64.             (population < unit-max)
  65.             (goal need-deathmatch-villagers NO)
  66.         )
  67.     )
  68. =>
  69.     (train light-cavalry)
  70. )
  71. #end-if
  72. ;*********************************************************
  73. #load-if-defined BYZANTINE-CIV
  74. ;train cataphracts, hvy HA, arbalests, handgunners
  75. (defrule
  76.     (true)
  77. =>
  78.     (set-goal combat-arm CAVALRY)
  79.     (set-goal 36 YES)
  80.     (set-goal 37 2)
  81.     (set-goal 38 YES)
  82.     (set-goal 39 YES)
  83.  
  84.     (set-strategic-number sn-wood-gatherer-percentage 20)
  85.     (set-strategic-number sn-food-gatherer-percentage 35)
  86.     (set-strategic-number sn-gold-gatherer-percentage 35)
  87.     (set-strategic-number sn-stone-gatherer-percentage 10)
  88.     (disable-self)
  89. )
  90.  
  91. (defrule
  92.     (goal secondary-build 1)
  93. =>
  94.     (generate-random-number 2)
  95. )
  96.  
  97. (defrule
  98.     (goal secondary-build 1)
  99.     (random-number == 1)
  100.     (can-train heavy-cavalry-archer)
  101.     (or
  102.         (population < deathmatch-unit-max)
  103.         (and
  104.             (population < unit-max)
  105.             (goal need-deathmatch-villagers NO)
  106.         )
  107.     )
  108. =>
  109.     (train heavy-cavalry-archer)
  110.     (set-goal secondary-build 0)
  111. )
  112.  
  113. (defrule
  114.     (goal secondary-build 1)
  115.     (random-number == 2)
  116.     (or
  117.         (can-train hand-cannoneer)
  118.         (can-train arbalest)
  119.     )
  120.     (or
  121.         (population < deathmatch-unit-max)
  122.         (and
  123.             (population < unit-max)
  124.             (goal need-deathmatch-villagers NO)
  125.         )
  126.     )
  127. =>
  128.     (train hand-cannoneer)
  129.     (train arbalest)
  130.     (set-goal secondary-build 0)
  131. )
  132. #end-if
  133. ;************************************************
  134. #load-if-defined CELTIC-CIV
  135. ;train woad raiders, paladins, lt cav, hvy HA, hvy scorps
  136. (defrule
  137.     (true)
  138. =>
  139.     (set-goal combat-arm INFANTRY)
  140.     (set-goal 36 2)
  141.     (set-goal 37 YES)
  142.     (set-goal 38 YES)
  143.     (set-goal 39 NO)
  144.  
  145.     (set-strategic-number sn-wood-gatherer-percentage 20)
  146.     (set-strategic-number sn-food-gatherer-percentage 50)
  147.     (set-strategic-number sn-gold-gatherer-percentage 25)
  148.     (set-strategic-number sn-stone-gatherer-percentage 5)
  149.     (disable-self)
  150. )
  151.  
  152. (defrule
  153.     (goal secondary-build 1)
  154. =>
  155.     (generate-random-number 4)
  156. )
  157.  
  158. (defrule
  159.     (goal secondary-build 1)
  160.     (random-number == 1)
  161.     (can-train paladin)
  162.     (or
  163.         (population < deathmatch-unit-max)
  164.         (and
  165.             (population < unit-max)
  166.             (goal need-deathmatch-villagers NO)
  167.         )
  168.     )
  169. =>
  170.     (train paladin)
  171.     (set-goal secondary-build 0)
  172. )
  173.  
  174. (defrule
  175.     (goal secondary-build 1)
  176.     (random-number == 2)
  177.     (can-train light-cavalry)
  178.     (or
  179.         (population < deathmatch-unit-max)
  180.         (and
  181.             (population < unit-max)
  182.             (goal need-deathmatch-villagers NO)
  183.         )
  184.     )
  185.     (or
  186.         (current-age < imperial-age)
  187.         (not (can-afford-unit paladin) )
  188.     )
  189. =>
  190.     (train light-cavalry)
  191.     (set-goal secondary-build 0)
  192. )
  193.  
  194. (defrule
  195.     (goal secondary-build 1)
  196.     (random-number == 3)
  197.     (can-train heavy-cavalry-archer)
  198.     (or
  199.         (population < deathmatch-unit-max)
  200.         (and
  201.             (population < unit-max)
  202.             (goal need-deathmatch-villagers NO)
  203.         )
  204.     )
  205. =>
  206.     (train heavy-cavalry-archer)
  207.     (set-goal secondary-build 0)
  208. )
  209.  
  210. (defrule
  211.     (goal secondary-build 1)
  212.     (random-number == 4)
  213.     (can-train heavy-scorpion)
  214.     (or
  215.         (population < deathmatch-unit-max)
  216.         (and
  217.             (population < unit-max)
  218.             (goal need-deathmatch-villagers NO)
  219.         )
  220.     )
  221. =>
  222.     (train heavy-scorpion)
  223.     (set-goal secondary-build 0)
  224. )
  225.  
  226. #end-if
  227. ;********************************
  228. #load-if-defined CHINESE-CIV
  229. ;train chu-ko-nu, champs, light cav, hvy scorps; 
  230. (defrule
  231.     (true)
  232. =>
  233.     (set-goal combat-arm ARCHER)
  234.     (set-goal 36 YES)
  235.     (set-goal 37 NO)
  236.     (set-goal 38 YES)
  237.     (set-goal 39 2)
  238.  
  239.     (set-strategic-number sn-wood-gatherer-percentage 35)
  240.     (set-strategic-number sn-food-gatherer-percentage 25)
  241.     (set-strategic-number sn-gold-gatherer-percentage 35)
  242.     (set-strategic-number sn-stone-gatherer-percentage 5)
  243.     (disable-self)
  244. )
  245.  
  246. (defrule
  247.     (goal secondary-build 1)
  248. =>
  249.     (generate-random-number 3)
  250. )
  251.  
  252. (defrule
  253.     (goal secondary-build 1)
  254.     (random-number == 1)
  255.     (can-train champion)
  256.     (or
  257.         (population < deathmatch-unit-max)
  258.         (and
  259.             (population < unit-max)
  260.             (goal need-deathmatch-villagers NO)
  261.         )
  262.     )
  263. =>
  264.     (train champion)
  265.     (set-goal secondary-build 0)
  266. )
  267.  
  268. (defrule
  269.     (goal secondary-build 1)
  270.     (random-number == 3)
  271.     (can-train light-cavalry)
  272.     (or
  273.         (population < deathmatch-unit-max)
  274.         (and
  275.             (population < unit-max)
  276.             (goal need-deathmatch-villagers NO)
  277.         )
  278.     )
  279. =>
  280.     (train light-cavalry)
  281.     (set-goal secondary-build 0)
  282. )
  283.  
  284. (defrule
  285.     (goal secondary-build 1)
  286.     (random-number == 3)
  287.     (can-train heavy-scorpion)
  288.     (or
  289.         (population < deathmatch-unit-max)
  290.         (and
  291.             (population < unit-max)
  292.             (goal need-deathmatch-villagers NO)
  293.         )
  294.     )
  295. =>
  296.     (train heavy-scorpion)
  297.     (set-goal secondary-build 0)
  298. )
  299. #end-if
  300. ;*******************************
  301. #load-if-defined FRANKISH-CIV
  302. ;train throwing-axe, paladins, lt cav, hvy HA, hvy scorps
  303. (defrule
  304.     (true)
  305. =>
  306.     (set-goal combat-arm INFANTRY)
  307.     (set-goal 36 2)
  308.     (set-goal 37 YES)
  309.     (set-goal 38 YES)
  310.     (set-goal 39 NO)
  311.  
  312.     (set-strategic-number sn-wood-gatherer-percentage 20)
  313.     (set-strategic-number sn-food-gatherer-percentage 50)
  314.     (set-strategic-number sn-gold-gatherer-percentage 25)
  315.     (set-strategic-number sn-stone-gatherer-percentage 5)
  316.     (disable-self)
  317. )
  318.  
  319. (defrule
  320.     (goal secondary-build 1)
  321. =>
  322.     (generate-random-number 4)
  323. )
  324.  
  325. (defrule
  326.     (goal secondary-build 1)
  327.     (random-number == 1)
  328.     (can-train paladin)
  329.     (or
  330.         (population < deathmatch-unit-max)
  331.         (and
  332.             (population < unit-max)
  333.             (goal need-deathmatch-villagers NO)
  334.         )
  335.     )
  336. =>
  337.     (train paladin)
  338.     (set-goal secondary-build 0)
  339. )
  340.  
  341. (defrule
  342.     (goal secondary-build 1)
  343.     (random-number == 2)
  344.     (can-train light-cavalry)
  345.     (or
  346.         (population < deathmatch-unit-max)
  347.         (and
  348.             (population < unit-max)
  349.             (goal need-deathmatch-villagers NO)
  350.         )
  351.     )
  352.     (or
  353.         (current-age < imperial-age)
  354.         (not (can-afford-unit paladin) )
  355.     )
  356. =>
  357.     (train light-cavalry)
  358.     (set-goal secondary-build 0)
  359. )
  360.  
  361. (defrule
  362.     (goal secondary-build 1)
  363.     (random-number == 3)
  364.     (can-train heavy-cavalry-archer)
  365.     (or
  366.         (population < deathmatch-unit-max)
  367.         (and
  368.             (population < unit-max)
  369.             (goal need-deathmatch-villagers NO)
  370.         )
  371.     )
  372. =>
  373.     (train heavy-cavalry-archer)
  374.     (set-goal secondary-build 0)
  375. )
  376.  
  377. (defrule
  378.     (goal secondary-build 1)
  379.     (random-number == 4)
  380.     (can-train heavy-scorpion)
  381.     (or
  382.         (population < deathmatch-unit-max)
  383.         (and
  384.             (population < unit-max)
  385.             (goal need-deathmatch-villagers NO)
  386.         )
  387.     )
  388. =>
  389.     (train heavy-scorpion)
  390.     (set-goal secondary-build 0)
  391. )
  392. #end-if
  393. ;****************************
  394. #load-if-defined GOTHIC-CIV
  395. ;train huskarls, lt cav, hvy HA, hvy scorps
  396. (defrule
  397.     (true)
  398. =>
  399.     (set-goal combat-arm INFANTRY)
  400.     (set-goal 36 2)
  401.     (set-goal 37 NO)
  402.     (set-goal 38 YES)
  403.     (set-goal 39 NO)
  404.  
  405.     (set-strategic-number sn-wood-gatherer-percentage 20)
  406.     (set-strategic-number sn-food-gatherer-percentage 50)
  407.     (set-strategic-number sn-gold-gatherer-percentage 25)
  408.     (set-strategic-number sn-stone-gatherer-percentage 5)
  409.     (disable-self)
  410. )
  411.  
  412. (defrule
  413.     (goal secondary-build 1)
  414. =>
  415.     (generate-random-number 3)
  416. )
  417.  
  418. (defrule
  419.     (goal secondary-build 1)
  420.     (random-number == 1)
  421.     (can-train light-cavalry)
  422.     (or
  423.         (population < deathmatch-unit-max)
  424.         (and
  425.             (population < unit-max)
  426.             (goal need-deathmatch-villagers NO)
  427.         )
  428.     )
  429. =>
  430.     (train light-cavalry)
  431.     (set-goal secondary-build 0)
  432. )
  433.  
  434. (defrule
  435.     (goal secondary-build 1)
  436.     (random-number == 2)
  437.     (can-train heavy-cavalry-archer)
  438.     (or
  439.         (population < deathmatch-unit-max)
  440.         (and
  441.             (population < unit-max)
  442.             (goal need-deathmatch-villagers NO)
  443.         )
  444.     )
  445. =>
  446.     (train heavy-cavalry-archer)
  447.     (set-goal secondary-build 0)
  448. )
  449.  
  450. (defrule
  451.     (goal secondary-build 1)
  452.     (random-number == 3)
  453.     (can-train heavy-scorpion)
  454.     (or
  455.         (population < deathmatch-unit-max)
  456.         (and
  457.             (population < unit-max)
  458.             (goal need-deathmatch-villagers NO)
  459.         )
  460.     )
  461. =>
  462.     (train heavy-scorpion)
  463.     (set-goal secondary-build 0)
  464. )
  465. #end-if
  466. ;********************************
  467. #load-if-defined JAPANESE-CIV
  468. ;train samurai, hvy HA, arbalests, hand-cannoneer, hvy scorps
  469. (defrule
  470.     (true)
  471. =>
  472.     (set-goal combat-arm INFANTRY)
  473.     (set-goal 36 2)
  474.     (set-goal 37 NO)
  475.     (set-goal 38 YES)
  476.     (set-goal 39 YES)
  477.  
  478.     (set-strategic-number sn-wood-gatherer-percentage 20)
  479.     (set-strategic-number sn-food-gatherer-percentage 50)
  480.     (set-strategic-number sn-gold-gatherer-percentage 25)
  481.     (set-strategic-number sn-stone-gatherer-percentage 5)
  482.     (disable-self)
  483. )
  484.  
  485. (defrule
  486.     (goal secondary-build 1)
  487. =>
  488.     (generate-random-number 3)
  489. )
  490.  
  491. (defrule
  492.     (goal secondary-build 1)
  493.     (random-number == 1)
  494.     (can-train heavy-cavalry-archer)
  495.     (or
  496.         (population < deathmatch-unit-max)
  497.         (and
  498.             (population < unit-max)
  499.             (goal need-deathmatch-villagers NO)
  500.         )
  501.     )
  502. =>
  503.     (train heavy-cavalry-archer)
  504.     (set-goal secondary-build 0)
  505. )
  506.  
  507. (defrule
  508.     (goal secondary-build 1)
  509.     (random-number == 2)
  510.     (or
  511.         (can-train hand-cannoneer)
  512.         (can-train arbalest)
  513.     )
  514.     (or
  515.         (population < deathmatch-unit-max)
  516.         (and
  517.             (population < unit-max)
  518.             (goal need-deathmatch-villagers NO)
  519.         )
  520.     )
  521. =>
  522.     (train hand-cannoneer)
  523.     (train arbalest)
  524.     (set-goal secondary-build 0)
  525. )
  526.  
  527. (defrule
  528.     (goal secondary-build 1)
  529.     (random-number == 3)
  530.     (can-train heavy-scorpion)
  531.     (or
  532.         (population < deathmatch-unit-max)
  533.         (and
  534.             (population < unit-max)
  535.             (goal need-deathmatch-villagers NO)
  536.         )
  537.     )
  538. =>
  539.     (train heavy-scorpion)
  540.     (set-goal secondary-build 0)
  541. )
  542. #end-if
  543. ;*********************************
  544. #load-if-defined MONGOL-CIV
  545. ;trains mangudai, champs
  546. (defrule
  547.     (true)
  548. =>
  549.     (set-goal combat-arm CAVARCHER)
  550.     (set-goal 36 YES)
  551.     (set-goal 37 NO)
  552.     (set-goal 38 2)
  553.     (set-goal 39 YES)
  554.  
  555.     (set-strategic-number sn-wood-gatherer-percentage 35)
  556.     (set-strategic-number sn-food-gatherer-percentage 25)
  557.     (set-strategic-number sn-gold-gatherer-percentage 35)
  558.     (set-strategic-number sn-stone-gatherer-percentage 5)
  559.     (disable-self)
  560. )
  561.  
  562. (defrule
  563.     (goal secondary-build 1)
  564.     (can-train champion)
  565.     (or
  566.         (population < deathmatch-unit-max)
  567.         (and
  568.             (population < unit-max)
  569.             (goal need-deathmatch-villagers NO)
  570.         )
  571.     )
  572. =>
  573.     (train champion)
  574.     (set-goal secondary-build 0)
  575. )
  576. #end-if
  577. ;***********************************
  578. #load-if-defined PERSIAN-CIV
  579. ;trains elephants, hvy HA
  580. (defrule
  581.     (true)
  582. =>
  583.     (set-goal combat-arm CAVALRY)
  584.     (set-goal 36 NO)
  585.     (set-goal 37 YES)
  586.     (set-goal 38 YES)
  587.     (set-goal 39 NO)
  588.  
  589.     (set-strategic-number sn-wood-gatherer-percentage 20)
  590.     (set-strategic-number sn-food-gatherer-percentage 50)
  591.     (set-strategic-number sn-gold-gatherer-percentage 25)
  592.     (set-strategic-number sn-stone-gatherer-percentage 5)
  593.     (disable-self)
  594. )
  595.  
  596. (defrule
  597.     (goal secondary-build 1)
  598.     (can-train heavy-cavalry-archer)
  599.     (or
  600.         (population < deathmatch-unit-max)
  601.         (and
  602.             (population < unit-max)
  603.             (goal need-deathmatch-villagers NO)
  604.         )
  605.     )
  606. =>
  607.     (train heavy-cavalry-archer)
  608.     (set-goal secondary-build 0)
  609. )
  610.  
  611. #end-if
  612. ;***********************************
  613. #load-if-defined SARACEN-CIV
  614. ;trains mamluks, hvy HA, arbalests, hand cannoneers
  615. (defrule
  616.     (true)
  617. =>
  618.     (set-goal combat-arm CAVALRY)
  619.     (set-goal 36 YES)
  620.     (set-goal 37 NO)
  621.     (set-goal 38 YES)
  622.     (set-goal 39 YES)
  623.  
  624.     (set-strategic-number sn-wood-gatherer-percentage 20)
  625.     (set-strategic-number sn-food-gatherer-percentage 45)
  626.     (set-strategic-number sn-gold-gatherer-percentage 30)
  627.     (set-strategic-number sn-stone-gatherer-percentage 5)
  628.     (disable-self)
  629. )
  630.  
  631. (defrule
  632.     (goal secondary-build 1)
  633. =>
  634.     (generate-random-number 2)
  635. )
  636.  
  637. (defrule
  638.     (goal secondary-build 1)
  639.     (random-number == 1)
  640.     (can-train heavy-cavalry-archer)
  641.     (or
  642.         (population < deathmatch-unit-max)
  643.         (and
  644.             (population < unit-max)
  645.             (goal need-deathmatch-villagers NO)
  646.         )
  647.     )
  648. =>
  649.     (train heavy-cavalry-archer)
  650.     (set-goal secondary-build 0)
  651. )
  652.  
  653. (defrule
  654.     (goal secondary-build 1)
  655.     (random-number == 2)
  656.     (or
  657.         (can-train hand-cannoneer)
  658.         (can-train arbalest)
  659.     )
  660.     (or
  661.         (population < deathmatch-unit-max)
  662.         (and
  663.             (population < unit-max)
  664.             (goal need-deathmatch-villagers NO)
  665.         )
  666.     )
  667. =>
  668.     (train hand-cannoneer)
  669.     (train arbalest)
  670.     (set-goal secondary-build 0)
  671. )
  672.  
  673. #end-if
  674. ;*********************************
  675. #load-if-defined TEUTONIC-CIV
  676. ;trains TK, paladins, hvy scorps
  677. (defrule
  678.     (true)
  679. =>
  680.     (set-goal combat-arm INFANTRY)
  681.     (set-goal 36 2)
  682.     (set-goal 37 YES)
  683.     (set-goal 38 NO)
  684.     (set-goal 39 NO)
  685.  
  686.     (set-strategic-number sn-wood-gatherer-percentage 20)
  687.     (set-strategic-number sn-food-gatherer-percentage 50)
  688.     (set-strategic-number sn-gold-gatherer-percentage 25)
  689.     (set-strategic-number sn-stone-gatherer-percentage 5)
  690.     (disable-self)
  691. )
  692.  
  693. (defrule
  694.     (goal secondary-build 1)
  695. =>
  696.     (generate-random-number 2)
  697. )
  698.  
  699. (defrule
  700.     (goal secondary-build 1)
  701.     (random-number == 1)
  702.     (can-train paladin)
  703.     (or
  704.         (population < deathmatch-unit-max)
  705.         (and
  706.             (population < unit-max)
  707.             (goal need-deathmatch-villagers NO)
  708.         )
  709.     )
  710. =>
  711.     (train paladin)
  712.     (set-goal secondary-build 0)
  713. )
  714.  
  715. (defrule
  716.     (goal secondary-build 1)
  717.     (random-number == 2)
  718.     (can-train heavy-scorpion)
  719.     (or
  720.         (population < deathmatch-unit-max)
  721.         (and
  722.             (population < unit-max)
  723.             (goal need-deathmatch-villagers NO)
  724.         )
  725.     )
  726. =>
  727.     (train heavy-scorpion)
  728.     (set-goal secondary-build 0)
  729. )
  730. #end-if
  731. ;************************************
  732. #load-if-defined TURKISH-CIV
  733. ;trains janissaries, champs, lt cav, hvy scorp
  734. (defrule
  735.     (true)
  736. =>
  737.     (set-goal combat-arm ARCHER)
  738.     (set-goal 36 YES)
  739.     (set-goal 37 NO)
  740.     (set-goal 38 YES)
  741.     (set-goal 39 NO)
  742.  
  743.     (set-strategic-number sn-wood-gatherer-percentage 25)
  744.     (set-strategic-number sn-food-gatherer-percentage 35)
  745.     (set-strategic-number sn-gold-gatherer-percentage 35)
  746.     (set-strategic-number sn-stone-gatherer-percentage 5)
  747.     (disable-self)
  748. )
  749.  
  750. (defrule
  751.     (goal secondary-build 1)
  752. =>
  753.     (generate-random-number 3)
  754. )
  755.  
  756. (defrule
  757.     (goal secondary-build 1)
  758.     (random-number == 1)
  759.     (can-train champion)
  760.     (or
  761.         (population < deathmatch-unit-max)
  762.         (and
  763.             (population < unit-max)
  764.             (goal need-deathmatch-villagers NO)
  765.         )
  766.     )
  767. =>
  768.     (train champion)
  769.     (set-goal secondary-build 0)
  770. )
  771.  
  772. (defrule
  773.     (goal secondary-build 1)
  774.     (random-number == 2)
  775.     (can-train light-cavalry)
  776.     (or
  777.         (population < deathmatch-unit-max)
  778.         (and
  779.             (population < unit-max)
  780.             (goal need-deathmatch-villagers NO)
  781.         )
  782.     )
  783. =>
  784.     (train light-cavalry)
  785.     (set-goal secondary-build 0)
  786. )
  787.  
  788. (defrule
  789.     (goal secondary-build 1)
  790.     (random-number == 3)
  791.     (can-train heavy-scorpion)
  792.     (or
  793.         (population < deathmatch-unit-max)
  794.         (and
  795.             (population < unit-max)
  796.             (goal need-deathmatch-villagers NO)
  797.         )
  798.     )
  799. =>
  800.     (train heavy-scorpion)
  801.     (set-goal secondary-build 0)
  802. )
  803. #end-if
  804. ;********************************
  805. #load-if-defined VIKING-CIV
  806. ;trains berserks, lt cav, arbalests, hvy scorp
  807. (defrule
  808.     (true)
  809. =>
  810.     (set-goal combat-arm INFANTRY)
  811.     (set-goal 36 2)
  812.     (set-goal 37 NO)
  813.     (set-goal 38 NO)
  814.     (set-goal 39 YES)
  815.  
  816.     (set-strategic-number sn-wood-gatherer-percentage 20)
  817.     (set-strategic-number sn-food-gatherer-percentage 50)
  818.     (set-strategic-number sn-gold-gatherer-percentage 25)
  819.     (set-strategic-number sn-stone-gatherer-percentage 5)
  820.     (disable-self)
  821. )
  822.  
  823. (defrule
  824.     (goal secondary-build 1)
  825. =>
  826.     (generate-random-number 3)
  827. )
  828.  
  829. (defrule
  830.     (goal secondary-build 1)
  831.     (random-number == 1)
  832.     (can-train light-cavalry)
  833.     (or
  834.         (population < deathmatch-unit-max)
  835.         (and
  836.             (population < unit-max)
  837.             (goal need-deathmatch-villagers NO)
  838.         )
  839.     )
  840. =>
  841.     (train light-cavalry)
  842.     (set-goal secondary-build 0)
  843. )
  844.  
  845. (defrule
  846.     (goal secondary-build 1)
  847.     (random-number == 2)
  848.     (can-train arbalest)
  849.     (or
  850.         (population < deathmatch-unit-max)
  851.         (and
  852.             (population < unit-max)
  853.             (goal need-deathmatch-villagers NO)
  854.         )
  855.     )
  856. =>
  857.     (train arbalest)
  858.     (set-goal secondary-build 0)
  859. )
  860.  
  861. (defrule
  862.     (goal secondary-build 1)
  863.     (random-number == 3)
  864.     (can-train heavy-scorpion)
  865.     (or
  866.         (population < deathmatch-unit-max)
  867.         (and
  868.             (population < unit-max)
  869.             (goal need-deathmatch-villagers NO)
  870.         )
  871.     )
  872. =>
  873.     (train heavy-scorpion)
  874.     (set-goal secondary-build 0)
  875. )
  876. #end-if
  877. ;*********************************************************
  878. ;*********************************************************
  879. #load-if-defined DIFFICULTY-EASIEST
  880. (defrule
  881.     (true)
  882. =>
  883.     (set-strategic-number sn-percent-enemy-sighted-response 10)
  884.     (set-strategic-number sn-consecutive-idle-unit-limit 60)
  885.     (set-strategic-number sn-easiest-reaction-percentage 20)
  886.     (set-difficulty-parameter ability-to-maintain-distance 100)
  887.     (set-difficulty-parameter ability-to-dodge-missiles 100)
  888.     (disable-self)
  889. )
  890. #end-if
  891. ;********************************
  892. #load-if-defined DIFFICULTY-EASY
  893. (load "petersen tower")
  894.  
  895. (defrule
  896.     (true)
  897. =>
  898.     (set-strategic-number sn-percent-enemy-sighted-response 25)
  899.     (set-strategic-number sn-consecutive-idle-unit-limit 20)
  900.     (set-strategic-number sn-easier-reaction-percentage 20)
  901.     (set-strategic-number sn-hits-before-alliance-change 50)
  902.     (set-difficulty-parameter ability-to-maintain-distance 75)
  903.     (set-difficulty-parameter ability-to-dodge-missiles 75)
  904.     (disable-self)
  905. )
  906. #end-if
  907.  
  908. ;********************************
  909. #load-if-defined DIFFICULTY-MODERATE
  910. (load "petersen tower")
  911. (load "petersen wonder")
  912.  
  913. (defrule
  914.     (true)
  915. =>
  916.     (set-strategic-number sn-percent-enemy-sighted-response 75)
  917.     (set-strategic-number sn-consecutive-idle-unit-limit 5)
  918.     (set-strategic-number sn-hits-before-alliance-change 25)
  919.     (set-difficulty-parameter ability-to-maintain-distance 50)
  920.     (set-difficulty-parameter ability-to-dodge-missiles 50)
  921.     (disable-self)
  922. )
  923. #end-if
  924.  
  925. ;********************************
  926. #load-if-defined DIFFICULTY-HARD
  927. (load "petersen tower")
  928. (load "petersen wonder")
  929.  
  930. (defrule
  931.     (true)
  932. =>
  933.     (set-strategic-number sn-percent-enemy-sighted-response 99)
  934.     (set-strategic-number sn-consecutive-idle-unit-limit 1)
  935.     (set-strategic-number sn-hits-before-alliance-change 10)
  936.     (set-difficulty-parameter ability-to-maintain-distance 0)
  937.     (set-difficulty-parameter ability-to-dodge-missiles 0)
  938.     (disable-self)
  939. )
  940. #end-if
  941.  
  942. ;********************************
  943. #load-if-defined DIFFICULTY-HARDEST
  944. (load "petersen tower")
  945. (load "petersen wonder")
  946.  
  947. (defrule
  948.     (true)
  949. =>
  950.     (set-strategic-number sn-percent-enemy-sighted-response 99)
  951.     (set-strategic-number sn-hits-before-alliance-change 10)
  952.     (set-difficulty-parameter ability-to-maintain-distance 0)
  953.     (set-difficulty-parameter ability-to-dodge-missiles 0)
  954.     (disable-self)
  955. )
  956. #end-if
  957. ;********************************
  958. ;********************************
  959.  
  960. (defrule
  961.     (true)
  962. =>
  963.     (set-goal military-parity YES)    ;goal 3
  964.     (set-goal attack-control NO)    ;goal 4
  965.     (set-goal need-deathmatch-villagers NO)    ;goal 7
  966.  
  967.     (set-goal secondary-build 0)    ;goal 8
  968.     (set-goal combat-arm NOTICE)    ;goal 11
  969.     (set-goal age-advancement NO)    ;goal 14
  970.  
  971.     (set-goal make-warboat NO)        ;goal 15
  972.     (set-goal upgrade-conflict NO)    ;goal 16
  973.     (set-goal pre-unique-arm NO)    ;goal 17
  974.  
  975.     (disable-self)
  976. )
  977.  
  978. (defrule
  979.     (true)
  980. =>
  981.     (set-goal wonder-attempt MAYBE)    ;goal 20
  982.     (set-goal enemy-soldiers NO)    ;goal 26
  983.  
  984.     (set-goal siege-available YES)    ;goal 34
  985.     (disable-self)
  986. )
  987.  
  988. (defrule
  989.     (cc-players-building-type-count any-enemy castle == 0)
  990. =>
  991.     (set-goal rush-control RUSHING)
  992. )
  993.  
  994. (defrule
  995.     (goal rush-control RUSHING)
  996.     (cc-players-building-type-count every-enemy castle > 0)
  997. =>
  998.     (set-goal rush-control NO)
  999. )
  1000.  
  1001. ;========================DARK AGE RULES
  1002. (defrule
  1003.     (true)
  1004. =>
  1005.     (set-strategic-number sn-coop-share-information 1)
  1006.     (set-strategic-number sn-coop-share-attacking 1)
  1007.     (set-strategic-number sn-maximum-town-size imperial-town-size)
  1008.  
  1009.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  1010.     (set-strategic-number sn-zero-priority-distance 250)
  1011.     (set-strategic-number sn-blot-exploration-map 0)
  1012.  
  1013.     (set-strategic-number sn-attack-intelligence 1)
  1014.     (set-strategic-number sn-gather-defense-units 1)
  1015.     (set-strategic-number sn-defense-distance 2)
  1016.  
  1017.     (set-strategic-number sn-maximum-gaia-attack-response 1)
  1018.     (set-strategic-number sn-ignore-attack-group-under-attack 1)
  1019.     (set-strategic-number sn-allow-civilian-defense 0)
  1020.  
  1021.     (disable-self)
  1022. )
  1023.  
  1024. (defrule
  1025.     (true)
  1026. =>
  1027.     (set-strategic-number sn-stone-dropsite-distance 3)
  1028.     (set-strategic-number sn-gold-dropsite-distance 3)
  1029.     (set-strategic-number sn-retask-gather-amount 20)
  1030.     (set-strategic-number sn-camp-max-distance 15)
  1031.  
  1032.     (set-strategic-number sn-mill-max-distance 15)
  1033.     (set-strategic-number sn-enemy-sighted-response-distance 15)
  1034.     (set-strategic-number sn-group-form-distance 10)
  1035.  
  1036.     (set-strategic-number sn-town-defend-priority 7)
  1037.     (set-strategic-number sn-gold-defend-priority 2)
  1038.     (set-strategic-number sn-stone-defend-priority 3)
  1039.     (set-strategic-number sn-forage-defend-priority 0)
  1040.  
  1041.     (disable-self)
  1042. )
  1043.  
  1044. (defrule
  1045.     (true)
  1046. =>
  1047.     (set-strategic-number sn-relic-defend-priority 0)
  1048.     (set-strategic-number sn-cap-civilian-gatherers 100)
  1049.     (set-strategic-number sn-percent-civilian-gatherers 0)
  1050.  
  1051.     (set-strategic-number sn-minimum-civilian-explorers 0)
  1052.     (set-strategic-number sn-cap-civilian-explorers 0)
  1053.     (set-strategic-number sn-percent-civilian-explorers 0)
  1054.  
  1055.     (set-strategic-number sn-cap-civilian-builders 12)
  1056.     (set-strategic-number sn-percent-civilian-builders 100)
  1057.  
  1058.     (disable-self)
  1059. )
  1060.  
  1061. (defrule
  1062.     (game-time > 600)
  1063. =>
  1064.     (set-strategic-number sn-blot-exploration-map 1)
  1065.     (disable-self)
  1066. )
  1067.  
  1068. (defrule
  1069.     (building-type-count siege-workshop >= 3)
  1070.     (building-type-count castle >= 3)
  1071.     (or
  1072.         (or
  1073.             (wood-amount < 5000)
  1074.             (food-amount < 5000)
  1075.         )
  1076.         (or
  1077.             (gold-amount < 2000)
  1078.             (stone-amount < 700)
  1079.         )
  1080.     )
  1081. =>
  1082.     (set-strategic-number sn-percent-civilian-builders 15)
  1083.     (set-strategic-number sn-percent-civilian-gatherers 85)
  1084.     (enable-timer t-lumbercamp 1)
  1085.     (disable-self)
  1086. )
  1087.  
  1088. (defrule
  1089.     (strategic-number sn-percent-civilian-gatherers == 85)
  1090.     (or
  1091.         (or
  1092.             (wood-amount < 500)
  1093.             (food-amount < 500)
  1094.         )
  1095.         (or
  1096.             (gold-amount < 500)
  1097.             (stone-amount < 100)
  1098.         )
  1099.     )
  1100. =>
  1101.     (set-strategic-number sn-percent-civilian-builders 10)
  1102.     (set-strategic-number sn-percent-civilian-gatherers 90)
  1103.     (disable-self)
  1104. )
  1105.  
  1106. ; villager count
  1107. (defrule
  1108.     (can-train villager)
  1109.     (civilian-population < 6)
  1110.     (or
  1111.         (and
  1112.             (current-age == feudal-age)
  1113.             (civilian-population < 8)
  1114.         )
  1115.         (or
  1116.             (and
  1117.                 (current-age == castle-age)
  1118.                 (civilian-population < 10)
  1119.             )
  1120.             (and
  1121.                 (current-age == imperial-age)
  1122.                 (civilian-population < civ-dark-rush)
  1123.             )
  1124.         )
  1125.     )
  1126. =>
  1127.     (train villager)
  1128. )
  1129.  
  1130. (defrule
  1131.     (strategic-number sn-percent-civilian-gatherers == 90)
  1132.     (civilian-population < civ-castle)
  1133.     (can-train villager)
  1134. =>
  1135.     (train villager)
  1136. )
  1137.  
  1138. (defrule
  1139.     (building-type-count-total lumber-camp > 0)
  1140.     (idle-farm-count <= 1)
  1141.     (sheep-and-forage-too-far)
  1142.     (can-build farm)
  1143. =>
  1144.     (build farm)
  1145. )
  1146.  
  1147. ;*********************************
  1148. ;age advancement
  1149. (defrule
  1150.     (can-research feudal-age)
  1151.     (or
  1152.         (players-current-age every-human >= feudal-age)
  1153.         (difficulty <= moderate)
  1154.     )
  1155. =>
  1156.     (research feudal-age)
  1157.     (set-goal age-advancement NOTICE)
  1158.     (enable-timer t-ageup 140)
  1159. )
  1160.  
  1161. (defrule
  1162.     (current-age == feudal-age)
  1163. =>
  1164.     (disable-timer t-ageup)
  1165.     (set-goal age-advancement NO)
  1166.     (disable-self)
  1167. )
  1168.  
  1169. (defrule
  1170.     (can-research castle-age)
  1171.     (or
  1172.         (players-current-age every-human >= castle-age)
  1173.         (difficulty <= moderate)
  1174.     )
  1175. =>
  1176.     (research castle-age)
  1177.     (set-goal age-advancement NOTICE)
  1178.     (enable-timer t-ageup 170)
  1179. )
  1180.  
  1181. (defrule
  1182.     (current-age == castle-age)
  1183. =>
  1184.     (disable-timer t-ageup)
  1185.     (set-goal age-advancement NO)
  1186.     (disable-self)
  1187. )
  1188.  
  1189. (defrule
  1190.     (can-research imperial-age)
  1191.     (or
  1192.         (difficulty <= moderate)
  1193.         (and
  1194.             (players-current-age every-human == imperial-age)
  1195.             (difficulty == easy)
  1196.         )
  1197.     )
  1198. =>
  1199.     (research imperial-age)
  1200.     (set-goal age-advancement NOTICE)
  1201.     (enable-timer t-ageup 200)
  1202. )
  1203.  
  1204. (defrule
  1205.     (difficulty <= moderate)
  1206.     (current-age == imperial-age)
  1207. =>
  1208.     (disable-timer t-ageup)
  1209.     (set-goal age-advancement NO)
  1210.     (disable-self)
  1211. )
  1212.  
  1213. (defrule
  1214.     (goal age-advancement NOTICE)
  1215.     (or
  1216.         (current-age < imperial-age)
  1217.         (and
  1218.             (current-age < imperial-age)
  1219.             (difficulty <= easy)
  1220.         )
  1221.     )
  1222.     (timer-triggered t-ageup)
  1223. =>
  1224.     (disable-timer t-ageup)
  1225.     (set-goal age-advancement NO)
  1226. )
  1227. ;*********************************
  1228. ;buildings
  1229. (defrule
  1230.     (difficulty <= moderate)
  1231.     (building-type-count-total house <= fifteen-percent-pop)
  1232.     (can-build house)
  1233. =>
  1234.     (build house)
  1235. )
  1236.  
  1237. #load-if-defined DIFFICULTY-EASIEST
  1238. (defrule
  1239.     (military-population < 10)
  1240.     (housing-headroom < 5)
  1241.     (population-headroom > 0)
  1242.     (can-build house)
  1243. =>
  1244.     (build house)
  1245. )
  1246. #end-if
  1247.  
  1248. #load-if-defined DIFFICULTY-EASY
  1249. (defrule
  1250.     (military-population < civ-dark-rush)
  1251.     (housing-headroom < 5)
  1252.     (population-headroom > 0)
  1253.     (can-build house)
  1254. =>
  1255.     (build house)
  1256. )
  1257. #end-if
  1258.  
  1259. (defrule
  1260.     (strategic-number sn-gold-gatherer-percentage > 0)
  1261.     (building-type-count mining-camp == 0)
  1262.     (resource-found gold)
  1263.     (can-build mining-camp)
  1264. =>
  1265.     (build mining-camp)
  1266. )
  1267.  
  1268. (defrule
  1269.     (strategic-number sn-wood-gatherer-percentage > 0)
  1270.     (building-type-count lumber-camp == 0)
  1271.     (can-build lumber-camp)
  1272. =>
  1273.     (build lumber-camp)
  1274. )
  1275.  
  1276. (defrule
  1277.     (current-age == imperial-age)
  1278.     (building-type-count siege-workshop > 0)
  1279.     (building-type-count castle > 0)
  1280.     (building-type-count town-center < 3)
  1281.     (can-build town-center)
  1282. =>
  1283.     (build town-center)
  1284. )
  1285.  
  1286. ;build the following after running low on resources
  1287.  
  1288. (defrule
  1289.     (strategic-number sn-percent-civilian-gatherers >= 85)
  1290.     (timer-triggered t-lumbercamp)
  1291.     (resource-found gold)
  1292.     (resource-found stone)
  1293.     (or
  1294.         (dropsite-min-distance gold > 7)
  1295.         (dropsite-min-distance stone > 7)
  1296.     )
  1297.     (can-build town-center)
  1298. =>
  1299.     (build town-center)
  1300. )
  1301.  
  1302. (defrule
  1303.     (strategic-number sn-percent-civilian-gatherers >= 85)
  1304.     (timer-triggered t-lumbercamp)
  1305.     (resource-found wood)
  1306.     (dropsite-min-distance wood > 7)
  1307.     (can-build town-center)
  1308. =>
  1309.     (build town-center)
  1310. )
  1311.  
  1312. (defrule
  1313.     (timer-triggered t-lumbercamp)
  1314. =>
  1315.     (disable-timer t-lumbercamp)
  1316.     (enable-timer t-lumbercamp 60)
  1317. )
  1318.  
  1319. (defrule
  1320.     (building-type-count-total mill == 0)
  1321.     (building-type-count-total market == 0)
  1322.     (can-build mill)
  1323. =>
  1324.     (build mill)
  1325. )
  1326.  
  1327. (defrule
  1328.     (building-type-count-total market == 0)
  1329.     (can-build market)
  1330. =>
  1331.     (build market)
  1332. )
  1333.  
  1334. (defrule
  1335.     (building-type-count-total blacksmith < 2)
  1336.     (can-build blacksmith)
  1337. =>
  1338.     (build blacksmith)
  1339. )
  1340.  
  1341. (defrule
  1342.     (building-type-count-total university == 0)
  1343.     (can-build university)
  1344. =>
  1345.     (build university)
  1346. )
  1347.  
  1348. (defrule
  1349.     (building-type-count-total monastery < 3)
  1350.     (can-build monastery)
  1351. =>
  1352.     (build monastery)
  1353. )
  1354.  
  1355. (defrule
  1356.     (can-build barracks)
  1357.     (or
  1358.         (building-type-count castle == 0)
  1359.         (building-type-count-total barracks < 2)
  1360.     )
  1361. =>
  1362.     (build barracks)
  1363. )
  1364.  
  1365. (defrule
  1366.     (building-type-count-total barracks == 2)
  1367.     (unit-type-count villager > 3)
  1368.     (can-build barracks)
  1369. =>
  1370.     (build-forward barracks)
  1371. )
  1372.  
  1373. (defrule
  1374.     (building-type-count-total archery-range < 2)
  1375.     (can-build archery-range)
  1376. =>
  1377.     (build archery-range)
  1378. )
  1379.  
  1380. (defrule
  1381.     (building-type-count-total archery-range == 2)
  1382.     (unit-type-count villager > 3)
  1383.     (can-build archery-range)
  1384. =>
  1385.     (build-forward archery-range)
  1386. )
  1387.  
  1388. (defrule
  1389.     (building-type-count-total stable < 2)
  1390.     (can-build stable)
  1391. =>
  1392.     (build stable)
  1393. )
  1394.  
  1395. (defrule
  1396.     (building-type-count-total stable == 2)
  1397.     (unit-type-count villager > 3)
  1398.     (can-build stable)
  1399. =>
  1400.     (build-forward stable)
  1401. )
  1402.  
  1403. (defrule
  1404.     (building-type-count-total siege-workshop < 2)
  1405.     (can-build siege-workshop)
  1406. =>
  1407.     (build siege-workshop)
  1408. )
  1409.  
  1410. (defrule
  1411.     (building-type-count-total siege-workshop > 1)
  1412.     (building-type-count-total siege-workshop < 4)
  1413.     (unit-type-count villager > 3)
  1414.     (can-build siege-workshop)
  1415. =>
  1416.     (build-forward siege-workshop)
  1417. )
  1418.  
  1419. (defrule
  1420.     (building-type-count-total castle < 3)
  1421.     (can-build castle)
  1422. =>
  1423.     (build castle)
  1424. )
  1425.  
  1426. (defrule
  1427.     (building-type-count-total castle > 2)
  1428.     (building-type-count-total castle < 5)
  1429.     (unit-type-count villager > 3)
  1430.     (can-build castle)
  1431. =>
  1432.     (build-forward castle)
  1433. )
  1434.  
  1435. (defrule
  1436.     (or
  1437.         (and
  1438.             (goal 1 1)
  1439.             (building-type-count-total dock < 2)
  1440.         )
  1441.         (and
  1442.             (goal 1 10)
  1443.             (building-type-count-total dock < 4)
  1444.         )
  1445.     )
  1446.     (can-build dock)
  1447. =>
  1448.     (build dock)
  1449. )
  1450. ;*********************************************************
  1451. ;DIPLOMACY
  1452. #load-if-not-defined TEAMS-LOCKED
  1453. (defrule
  1454.     (current-age >= feudal-age)
  1455.     (players-stance any-computer-ally neutral)
  1456. =>
  1457.     (set-stance this-any-computer-ally neutral)
  1458. )
  1459.  
  1460. (defrule
  1461.     (current-age >= feudal-age)
  1462.     (players-stance any-computer-ally enemy)
  1463. =>
  1464.     (set-stance this-any-computer-ally enemy)
  1465. )
  1466.  
  1467. (defrule
  1468.     (current-age >= feudal-age)
  1469.     (players-stance any-computer-neutral ally)
  1470. =>
  1471.     (set-stance this-any-computer-neutral ally)
  1472. )
  1473.  
  1474. (defrule
  1475.     (current-age >= feudal-age)
  1476.     (players-stance any-computer-neutral enemy)
  1477. =>
  1478.     (set-stance this-any-computer-neutral enemy)
  1479. )
  1480.  
  1481. (defrule
  1482.     (current-age >= feudal-age)
  1483.     (players-stance any-computer-enemy ally)
  1484. =>
  1485.     (set-stance this-any-computer-enemy ally)
  1486. )
  1487.  
  1488. (defrule
  1489.     (current-age >= feudal-age)
  1490.     (players-stance any-computer-enemy neutral)
  1491. =>
  1492.     (set-stance this-any-computer-enemy neutral)
  1493. )
  1494. #end-if
  1495. ;*****************************************
  1496. ;*****************************************
  1497. ;UPGRADES
  1498. (defrule
  1499.     (can-research my-unique-unit-upgrade)
  1500. =>
  1501.     (research my-unique-unit-upgrade)
  1502. )
  1503.  
  1504. ;DOCK
  1505. (defrule
  1506.     (not (goal 1 0) )
  1507.     (can-research ri-war-galley)
  1508. =>
  1509.     (research ri-war-galley)
  1510. )
  1511.  
  1512. (defrule
  1513.     (not (goal 1 0) )
  1514.     (can-research ri-galleon)
  1515. =>
  1516.     (research ri-galleon)
  1517. )
  1518.  
  1519. (defrule
  1520.     (not (goal 1 0) )
  1521.     (can-research ri-fast-fire-ship)
  1522. =>
  1523.     (research ri-fast-fire-ship)
  1524. )
  1525.  
  1526. (defrule
  1527.     (not (goal 1 0) )
  1528.     (goal military-parity NO)
  1529.     (can-research ri-heavy-demolition-ship)
  1530. =>
  1531.     (research ri-heavy-demolition-ship)
  1532. )
  1533.  
  1534. (defrule
  1535.     (not (goal 1 0) )
  1536.     (can-research ri-cannon-galleon)
  1537. =>
  1538.     (research ri-cannon-galleon)
  1539. )
  1540.  
  1541. (defrule
  1542.     (not (goal 1 0) )
  1543.     (can-research ri-deck-guns)
  1544. =>
  1545.     (research ri-deck-guns)
  1546. )
  1547.  
  1548. ;BARRACKS UPGRADES
  1549. (defrule
  1550.     (or
  1551.         (goal 36 YES)
  1552.         (and
  1553.             (building-type-count castle == 0)
  1554.             (goal 36 2)
  1555.         )
  1556.     )
  1557.     (can-research ri-man-at-arms)
  1558. =>
  1559.     (research ri-man-at-arms)
  1560. )
  1561.  
  1562. (defrule
  1563.     (or
  1564.         (goal 36 YES)
  1565.         (and
  1566.             (building-type-count castle == 0)
  1567.             (goal 36 2)
  1568.         )
  1569.     )
  1570.     (can-research ri-long-swordsman)
  1571. =>
  1572.     (research ri-long-swordsman)
  1573. )
  1574.  
  1575. (defrule
  1576.     (or
  1577.         (goal 36 YES)
  1578.         (and
  1579.             (building-type-count castle == 0)
  1580.             (goal 36 2)
  1581.         )
  1582.     )
  1583.     (can-research ri-two-handed-swordsman)
  1584. =>
  1585.     (research ri-two-handed-swordsman)
  1586. )
  1587.  
  1588. (defrule
  1589.     (or
  1590.         (goal 36 YES)
  1591.         (and
  1592.             (building-type-count castle == 0)
  1593.             (goal 36 2)
  1594.         )
  1595.     )
  1596.     (can-research ri-champion)
  1597. =>
  1598.     (research ri-champion)
  1599. )
  1600.  
  1601. (defrule
  1602.     (unit-type-count spearman > 0)
  1603.     (can-research ri-pikeman)
  1604. =>
  1605.     (research ri-pikeman)
  1606. )
  1607.  
  1608. ;STABLE
  1609. (defrule
  1610.     (or
  1611.         (goal 37 YES)
  1612.         (and
  1613.             (building-type-count castle == 0)
  1614.             (goal 37 2)
  1615.         )
  1616.     )
  1617.     (can-research ri-cavalier)
  1618. =>
  1619.     (research ri-cavalier)
  1620. )
  1621.  
  1622. (defrule
  1623.     (or
  1624.         (goal 37 YES)
  1625.         (and
  1626.             (building-type-count castle == 0)
  1627.             (goal 37 2)
  1628.         )
  1629.     )
  1630.     (can-research ri-paladin)
  1631. =>
  1632.     (research ri-paladin)
  1633. )
  1634.  
  1635. (defrule
  1636.     (can-research ri-light-cavalry)
  1637. =>
  1638.     (research ri-light-cavalry)
  1639. )
  1640.  
  1641. (defrule
  1642.     (unit-type-count camel > 0)
  1643.     (can-research ri-heavy-camel)
  1644. =>
  1645.     (research ri-heavy-camel)
  1646. )
  1647.  
  1648. ;ARCHERY RANGE
  1649. (defrule
  1650.     (or
  1651.         (goal 38 YES)
  1652.         (and
  1653.             (building-type-count castle == 0)
  1654.             (goal 38 2)
  1655.         )
  1656.     )
  1657.     (can-research ri-heavy-cavalry-archer)
  1658. =>
  1659.     (research ri-heavy-cavalry-archer)
  1660. )
  1661.  
  1662. (defrule
  1663.     (or
  1664.         (goal 39 YES)
  1665.         (and
  1666.             (building-type-count castle == 0)
  1667.             (goal 39 2)
  1668.         )
  1669.     )
  1670.     (can-research ri-crossbow)
  1671. =>
  1672.     (research ri-crossbow)
  1673. )
  1674.  
  1675. (defrule
  1676.     (or
  1677.         (goal 39 YES)
  1678.         (and
  1679.             (building-type-count castle == 0)
  1680.             (goal 39 2)
  1681.         )
  1682.     )
  1683.     (can-research ri-arbalest)
  1684. =>
  1685.     (research ri-arbalest)
  1686. )
  1687.  
  1688. (defrule
  1689.     (or
  1690.         (goal 39 YES)
  1691.         (and
  1692.             (building-type-count castle == 0)
  1693.             (goal 39 2)
  1694.         )
  1695.     )
  1696.     (can-research ri-hand-cannon)
  1697. =>
  1698.     (research ri-hand-cannon)
  1699. )
  1700.  
  1701. (defrule
  1702.     (unit-type-count skirmisher > 0)
  1703.     (can-research ri-elite-skirmisher)
  1704. =>
  1705.     (research ri-elite-skirmisher)
  1706. )
  1707.  
  1708. ;SIEGE EQUIPMENT
  1709. (defrule
  1710.     (or
  1711.         (goal combat-arm INFANTRY)
  1712.         (goal combat-arm ARCHER)
  1713.     )
  1714.     (can-research ri-heavy-scorpion)
  1715. =>
  1716.     (research ri-heavy-scorpion)
  1717. )
  1718.  
  1719. (defrule
  1720.     (can-research ri-capped-ram)
  1721.     (or
  1722.         (or
  1723.             (cc-players-building-type-count any-enemy town-center > 2)
  1724.             (cc-players-building-type-count any-enemy keep > 1)
  1725.         )
  1726.         (or
  1727.             (cc-players-building-type-count any-enemy bombard-tower > 0)
  1728.             (cc-players-building-type-count any-enemy castle > 0)
  1729.         )
  1730.     )
  1731. =>
  1732.     (research ri-capped-ram)
  1733. )
  1734.  
  1735. (defrule
  1736.     (or
  1737.         (or
  1738.             (cc-players-building-type-count any-enemy town-center > 2)
  1739.             (cc-players-building-type-count any-enemy keep > 3)
  1740.         )
  1741.         (or
  1742.             (cc-players-building-type-count any-enemy bombard-tower > 1)
  1743.             (cc-players-building-type-count any-enemy castle > 2)
  1744.         )
  1745.     )
  1746.     (can-research ri-siege-ram)
  1747. =>
  1748.     (research ri-siege-ram)
  1749. )
  1750.  
  1751. (defrule
  1752.     (can-research ri-onager)
  1753. =>
  1754.     (research ri-onager)
  1755. )
  1756.  
  1757. (defrule
  1758.     (can-research ri-siege-onager)
  1759. =>
  1760.     (research ri-siege-onager)
  1761. )
  1762.  
  1763. (defrule
  1764.     (can-research ri-bombard-cannon)
  1765. =>
  1766.     (research ri-bombard-cannon)
  1767. )
  1768. ;*********************************************************
  1769. ;UNIT PRODUCTION
  1770.  
  1771. (defrule
  1772.     (or
  1773.         (or
  1774.             (wood-amount < 5000)
  1775.             (food-amount < 5000)
  1776.         )
  1777.         (or
  1778.             (gold-amount < 2000)
  1779.             (stone-amount < 700)
  1780.         )
  1781.     )
  1782. =>
  1783.     (set-goal need-deathmatch-villagers YES)
  1784.     (disable-self)
  1785. )
  1786.  
  1787. (defrule
  1788.     (building-type-count castle == 0)
  1789.     (can-train militiaman-line)
  1790.     (or
  1791.         (population < deathmatch-unit-max)
  1792.         (and
  1793.             (population < unit-max)
  1794.             (goal need-deathmatch-villagers NO)
  1795.         )
  1796.     )
  1797.     (not (goal 36 NO) )
  1798. =>
  1799.     (train militiaman-line)
  1800. )
  1801.  
  1802. (defrule
  1803.     (building-type-count castle == 0)
  1804.     (can-train knight-line)
  1805.     (or
  1806.         (population < deathmatch-unit-max)
  1807.         (and
  1808.             (population < unit-max)
  1809.             (goal need-deathmatch-villagers NO)
  1810.         )
  1811.     )
  1812.     (not (goal 37 NO) )
  1813. =>
  1814.     (train knight-line)
  1815. )
  1816.  
  1817. (defrule
  1818.     (building-type-count castle == 0)
  1819.     (can-train cavalry-archer-line)
  1820.     (or
  1821.         (population < deathmatch-unit-max)
  1822.         (and
  1823.             (population < unit-max)
  1824.             (goal need-deathmatch-villagers NO)
  1825.         )
  1826.     )
  1827.     (not (goal 38 NO) )
  1828. =>
  1829.     (train cavalry-archer-line)
  1830. )
  1831.  
  1832. (defrule
  1833.     (building-type-count castle == 0)
  1834.     (can-train archer-line)
  1835.     (not (unit-available hand-cannoneer) )
  1836.     (or
  1837.         (population < deathmatch-unit-max)
  1838.         (and
  1839.             (population < unit-max)
  1840.             (goal need-deathmatch-villagers NO)
  1841.         )
  1842.     )
  1843.     (not (goal 39 NO) )
  1844. =>
  1845.     (train archer-line)
  1846. )
  1847.  
  1848. (defrule
  1849.     (building-type-count castle == 0)
  1850.     (can-train hand-cannoneer)
  1851.     (or
  1852.         (population < deathmatch-unit-max)
  1853.         (and
  1854.             (population < unit-max)
  1855.             (goal need-deathmatch-villagers NO)
  1856.         )
  1857.     )
  1858.     (not (goal 39 NO) )
  1859. =>
  1860.     (train hand-cannoneer)
  1861. )
  1862.  
  1863. (defrule
  1864.     (can-train my-unique-unit-line)
  1865.     (or
  1866.         (population < deathmatch-unit-max)
  1867.         (and
  1868.             (population < unit-max)
  1869.             (goal need-deathmatch-villagers NO)
  1870.         )
  1871.     )
  1872. =>
  1873.     (train my-unique-unit-line)
  1874.     (set-goal secondary-build 1)
  1875. )
  1876.  
  1877. ; monks
  1878. (defrule
  1879.     (unit-type-count my-unique-unit-line > ten-percent-pop)
  1880.     (unit-type-count-total monk == 0)
  1881.     (or
  1882.         (or
  1883.             (civ-selected celtic)
  1884.             (civ-selected gothic)
  1885.         )
  1886.         (or
  1887.             (or
  1888.                 (civ-selected mongol)
  1889.                 (civ-selected persian)
  1890.             )
  1891.             (civ-selected viking)
  1892.         )
  1893.     )
  1894.     (can-train monk)
  1895. =>
  1896.     (train monk)
  1897. )
  1898.  
  1899. (defrule
  1900.     (unit-type-count my-unique-unit-line > ten-percent-pop)
  1901.     (unit-type-count-total monk < five-percent-pop)
  1902.     (or
  1903.         (or
  1904.             (civ-selected chinese)
  1905.             (civ-selected frankish)
  1906.         )
  1907.         (civ-selected turkish)
  1908.     )
  1909.     (can-train monk)
  1910. =>
  1911.     (train monk)
  1912. )
  1913.  
  1914. (defrule
  1915.     (unit-type-count my-unique-unit-line > ten-percent-pop)
  1916.     (unit-type-count-total monk < ten-percent-pop)
  1917.     (or
  1918.         (civ-selected briton)
  1919.         (or
  1920.             (or
  1921.                 (civ-selected byzantine)
  1922.                 (civ-selected japanese)
  1923.             )
  1924.             (or
  1925.                 (civ-selected saracen)
  1926.                 (civ-selected teutonic)
  1927.             )
  1928.         )
  1929.     )
  1930.     (can-train monk)
  1931. =>
  1932.     (train monk)
  1933. )
  1934. ;*********************************************
  1935. ;BLACKSMITH
  1936. ;first level upgrades
  1937. (defrule
  1938.     (can-research ri-forging)
  1939.     (nand
  1940.         (goal 36 NO)
  1941.         (goal 37 NO)
  1942.     )
  1943. =>
  1944.     (research ri-forging)
  1945. )
  1946.  
  1947. (defrule
  1948.     (can-research ri-fletching)
  1949.     (or
  1950.         (nand
  1951.             (goal 38 NO)
  1952.             (goal 39 NO)
  1953.         )
  1954.         (or
  1955.             (building-type-count-total watch-tower > 0)
  1956.             (unit-type-count-total war-galley > 0)
  1957.         )
  1958.     )
  1959. =>
  1960.     (research ri-fletching)
  1961. )
  1962.  
  1963. (defrule
  1964.     (can-research ri-padded-archer-armor)
  1965.     (nand
  1966.         (goal 38 NO)
  1967.         (goal 39 NO)
  1968.     )
  1969. =>
  1970.     (research ri-padded-archer-armor)
  1971. )
  1972.  
  1973. (defrule
  1974.     (can-research ri-scale-mail)
  1975.     (not (goal 36 NO) )
  1976. =>
  1977.     (research ri-scale-mail)
  1978. )
  1979.  
  1980. (defrule
  1981.     (can-research ri-scale-barding)
  1982.     (not (goal 37 NO) )
  1983. =>
  1984.     (research ri-scale-barding)
  1985. )
  1986.  
  1987. ;second upgrades
  1988. (defrule
  1989.     (can-research ri-iron-casting)
  1990.     (nand
  1991.         (goal 36 NO)
  1992.         (goal 37 NO)
  1993.     )
  1994. =>
  1995.     (research ri-iron-casting)
  1996. )
  1997.  
  1998. (defrule
  1999.     (can-research ri-bodkin-arrow)
  2000.     (or
  2001.         (nand
  2002.             (goal 38 NO)
  2003.             (goal 39 NO)
  2004.         )
  2005.         (or
  2006.             (building-type-count-total watch-tower > 0)
  2007.             (unit-type-count-total war-galley > 0)
  2008.         )
  2009.     )
  2010. =>
  2011.     (research ri-bodkin-arrow)
  2012. )
  2013.  
  2014. (defrule
  2015.     (can-research ri-leather-archer-armor)
  2016.     (nand
  2017.         (goal 38 NO)
  2018.         (goal 39 NO)
  2019.     )
  2020. =>
  2021.     (research ri-leather-archer-armor)
  2022. )
  2023.  
  2024. (defrule
  2025.     (can-research ri-chain-mail)
  2026.     (not (goal 36 NO) )
  2027. =>
  2028.     (research ri-chain-mail)
  2029. )
  2030.  
  2031. (defrule
  2032.     (can-research ri-chain-barding)
  2033.     (not (goal 37 NO) )
  2034. =>
  2035.     (research ri-chain-barding)
  2036. )
  2037.  
  2038. ;third upgrades
  2039. (defrule
  2040.     (can-research ri-blast-furnace)
  2041.     (nand
  2042.         (goal 36 NO)
  2043.         (goal 37 NO)
  2044.     )
  2045. =>
  2046.     (research ri-blast-furnace)
  2047. )
  2048.  
  2049. (defrule
  2050.     (can-research ri-bracer)
  2051.     (or
  2052.         (nand
  2053.             (goal 38 NO)
  2054.             (goal 39 NO)
  2055.         )
  2056.         (or
  2057.             (building-type-count-total watch-tower > 0)
  2058.             (unit-type-count-total war-galley > 0)
  2059.         )
  2060.     )
  2061. =>
  2062.     (research ri-bracer)
  2063. )
  2064.  
  2065. (defrule
  2066.     (can-research ri-ring-archer-armor)
  2067.     (nand
  2068.         (goal 38 NO)
  2069.         (goal 39 NO)
  2070.     )
  2071. =>
  2072.     (research ri-ring-archer-armor)
  2073. )
  2074.  
  2075. (defrule
  2076.     (can-research ri-plate-mail)
  2077.     (not (goal 36 NO) )
  2078. =>
  2079.     (research ri-plate-mail)
  2080. )
  2081.  
  2082. (defrule
  2083.     (can-research ri-tracking)
  2084.     (not (goal 36 NO) )
  2085. =>
  2086.     (research ri-tracking)
  2087. )
  2088.  
  2089. (defrule
  2090.     (can-research ri-squires)
  2091.     (not (goal 36 NO) )
  2092. =>
  2093.     (research ri-squires)
  2094. )
  2095.  
  2096. (defrule
  2097.     (can-research ri-plate-barding)
  2098.     (not (goal 37 NO) )
  2099. =>
  2100.     (research ri-plate-barding)
  2101. )
  2102.  
  2103. (defrule
  2104.     (can-research ri-husbandry)
  2105.     (not (goal 37 NO) )
  2106. =>
  2107.     (research ri-husbandry)
  2108. )
  2109.  
  2110. ;SIEGE RESEARCH ITEMS
  2111. (defrule
  2112.     (can-research ri-siege-engineers)
  2113. =>
  2114.     (research ri-siege-engineers)
  2115. )
  2116.  
  2117. (defrule
  2118.     (can-research ri-hoardings)
  2119. =>
  2120.     (research ri-hoardings)
  2121. )
  2122.  
  2123. (defrule
  2124.     (not (goal 1 0) )
  2125.     (can-research ri-heated-shot)
  2126. =>
  2127.     (research ri-heated-shot)
  2128. )
  2129.  
  2130. (defrule
  2131.     (building-type-count-total watch-tower > 2)
  2132.     (can-research ri-guard-tower)
  2133. =>
  2134.     (research ri-guard-tower)
  2135. )
  2136.  
  2137. (defrule
  2138.     (building-type-count-total guard-tower > 2)
  2139.     (can-research ri-keep)
  2140. =>
  2141.     (research ri-keep)
  2142. )
  2143.  
  2144. (defrule
  2145.     (can-research ri-bombard-tower)
  2146. =>
  2147.     (research ri-bombard-tower)
  2148. )
  2149.  
  2150. (defrule
  2151.     (goal wall-build YES)
  2152.     (can-research ri-fortified-wall)
  2153. =>
  2154.     (research ri-fortified-wall)
  2155. )
  2156.  
  2157. ;SHIPS
  2158. (defrule
  2159.     (not (goal 1 0) )
  2160.     (can-research ri-careening)
  2161. =>
  2162.     (research ri-careening)
  2163. )
  2164.  
  2165. (defrule
  2166.     (not (goal 1 0) )
  2167.     (can-research ri-dry-dock)
  2168. =>
  2169.     (research ri-dry-dock)
  2170. )
  2171.  
  2172. (defrule
  2173.     (not (goal 1 0) )
  2174.     (can-research ri-shipwright)
  2175. =>
  2176.     (research ri-shipwright)
  2177. )
  2178.  
  2179. ;OTHER RESEARCH ITEMS
  2180. (defrule
  2181.     (can-research ri-ballistics)
  2182. =>
  2183.     (research ri-ballistics)
  2184. )
  2185.  
  2186. (defrule
  2187.     (can-research ri-chemistry)
  2188. =>
  2189.     (research ri-chemistry)
  2190. )
  2191.  
  2192. (defrule
  2193.     (can-research ri-conscription)
  2194. =>
  2195.     (research ri-conscription)
  2196. )
  2197.  
  2198. ;***********************************
  2199. ;ECONOMIC UPGRADES
  2200. ;***********************************
  2201. ;mining-camp items
  2202. (defrule
  2203.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2204.     (can-research ri-gold-mining)
  2205. =>
  2206.     (research ri-gold-mining)
  2207. )
  2208.  
  2209. (defrule
  2210.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2211.     (can-research ri-gold-shaft-mining)
  2212. =>
  2213.     (research ri-gold-shaft-mining)
  2214. )
  2215.  
  2216. (defrule
  2217.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2218.     (research-completed ri-gold-mining)
  2219.     (can-research ri-stone-mining)
  2220. =>
  2221.     (research ri-stone-mining)
  2222. )
  2223.  
  2224. (defrule
  2225.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2226.     (research-completed ri-gold-shaft-mining)
  2227.     (can-research ri-stone-shaft-mining)
  2228. =>
  2229.     (research ri-stone-shaft-mining)
  2230. )
  2231.  
  2232. ;university stuff
  2233. (defrule
  2234.     (can-research ri-masonry)
  2235. =>
  2236.     (research ri-masonry)
  2237. )
  2238.  
  2239. (defrule
  2240.     (can-research ri-architecture)
  2241. =>
  2242.     (research ri-architecture)
  2243. )
  2244.  
  2245. (defrule
  2246.     (can-research ri-stonecutting)
  2247. =>
  2248.     (research ri-stonecutting)
  2249. )
  2250.  
  2251. ;market & town center
  2252. (defrule
  2253.     (can-research ri-town-watch)
  2254. =>
  2255.     (research ri-town-watch)
  2256. )
  2257.  
  2258. (defrule
  2259.     (can-research ri-town-patrol)
  2260. =>
  2261.     (research ri-town-patrol)
  2262. )
  2263.  
  2264. (defrule
  2265.     (player-in-game any-ally)
  2266.     (can-research ri-cartography)
  2267. =>
  2268.     (research ri-cartography)
  2269. )
  2270.  
  2271. (defrule
  2272.     (can-research ri-guilds)
  2273. =>
  2274.     (research ri-guilds)
  2275. )
  2276.  
  2277. (defrule
  2278.     (current-age == imperial-age)
  2279.     (can-research ri-loom)
  2280. =>
  2281.     (research ri-loom)
  2282. )
  2283.  
  2284. (defrule
  2285.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2286.     (can-research ri-wheel-barrow)
  2287. =>
  2288.     (research ri-wheel-barrow)
  2289. )
  2290.  
  2291. (defrule
  2292.     (strategic-number sn-percent-civilian-gatherers >= 85)
  2293.     (can-research ri-hand-cart)
  2294. =>
  2295.     (research ri-hand-cart)
  2296. )
  2297.  
  2298. (defrule
  2299.     (player-in-game any-ally)
  2300.     (can-research ri-coinage)
  2301. =>
  2302.     (research ri-coinage)
  2303. )
  2304.  
  2305. (defrule
  2306.     (player-in-game any-ally)
  2307.     (can-research ri-banking)
  2308. =>
  2309.     (research ri-banking)
  2310. )
  2311.  
  2312. ;monk upgrades
  2313. (defrule
  2314.     (can-research ri-faith)
  2315.     (or
  2316.         (cc-players-unit-type-count any-enemy monk > five-percent-pop)
  2317.         (cc-players-unit-type-count any-enemy monk > 5)
  2318.     )
  2319. =>
  2320.     (research ri-faith)
  2321. )
  2322.  
  2323. (defrule
  2324.     (difficulty <= moderate)
  2325.     (can-research ri-atonement)
  2326.     (or
  2327.         (cc-players-unit-type-count any-enemy monk > five-percent-pop)
  2328.         (cc-players-unit-type-count any-enemy monk > 5)
  2329.     )
  2330. =>
  2331.     (research ri-atonement)
  2332. )
  2333.  
  2334. (defrule
  2335.     (can-research ri-block-printing)
  2336.     (unit-type-count monk > five-percent-pop)
  2337. =>
  2338.     (research ri-block-printing)
  2339. )
  2340.  
  2341. (defrule
  2342.     (can-research ri-illumination)
  2343.     (unit-type-count monk > 1)
  2344. =>
  2345.     (research ri-illumination)
  2346. )
  2347.  
  2348. (defrule
  2349.     (can-research ri-fervor)
  2350.     (unit-type-count monk > 1)
  2351. =>
  2352.     (research ri-fervor)
  2353. )
  2354.  
  2355. (defrule
  2356.     (difficulty <= moderate)
  2357.     (can-research ri-redemption)
  2358.     (unit-type-count monk > five-percent-pop)
  2359. =>
  2360.     (research ri-redemption)
  2361. )
  2362.  
  2363. (defrule
  2364.     (can-research ri-sanctity)
  2365.     (unit-type-count monk > 1)
  2366. =>
  2367.     (research ri-sanctity)
  2368. )
  2369. ;***********************************
  2370. ;MARKET STUFF
  2371. ;***********************************
  2372. (defrule
  2373.     (wood-amount > 5000)
  2374.     (commodity-selling-price wood >= 20)
  2375.     (can-sell-commodity wood)
  2376. =>
  2377.     (chat-local-to-self "abuse market; sell wood")
  2378.     (sell-commodity wood)
  2379. )
  2380.  
  2381. (defrule
  2382.     (food-amount > 5000)
  2383.     (commodity-selling-price food >= 20)
  2384.     (can-sell-commodity food)
  2385. =>
  2386.     (chat-local-to-self "abuse market; sell food")
  2387.     (sell-commodity food)
  2388. )
  2389.  
  2390. (defrule
  2391.     (gold-amount < 1200)
  2392.     (wood-amount > 5000)
  2393.     (can-sell-commodity wood)
  2394. =>
  2395.     (chat-local-to-self "need gold; sell wood")
  2396.     (sell-commodity wood)
  2397. )
  2398.  
  2399. (defrule
  2400.     (gold-amount < 1200)
  2401.     (food-amount > 5000)
  2402.     (can-sell-commodity food)
  2403. =>
  2404.     (chat-local-to-self "need gold; sell food")
  2405.     (sell-commodity food)
  2406. )
  2407.  
  2408. (defrule
  2409.     (gold-amount < 1200)
  2410.     (stone-amount > 1000)
  2411.     (building-type-count-total castle >= 5)
  2412.     (can-sell-commodity stone)
  2413. =>
  2414.     (chat-local-to-self "need gold; sell stone")
  2415.     (sell-commodity stone)
  2416. )
  2417.  
  2418. (defrule
  2419.     (stone-amount < 650)
  2420.     (gold-amount > 5000)
  2421.     (building-type-count-total castle < 5)
  2422.     (can-buy-commodity stone)
  2423. =>
  2424.     (chat-local-to-self "need stone")
  2425.     (buy-commodity stone)
  2426. )
  2427.  
  2428. (defrule
  2429.     (wood-amount < 1100)
  2430.     (gold-amount > 5000)
  2431.     (can-buy-commodity wood)
  2432. =>
  2433.     (chat-local-to-self "need wood")
  2434.     (buy-commodity wood)
  2435. )
  2436.  
  2437. (defrule
  2438.     (food-amount < 1600)
  2439.     (gold-amount > 5000)
  2440.     (can-buy-commodity food)
  2441. =>
  2442.     (chat-local-to-self "need food")
  2443.     (buy-commodity food)
  2444. )
  2445.  
  2446.